MIRC DATABASE TUTORIAL |
By Yochai Timmer Yochai@Dorot.org.il |
Design |
Now that you know how the database types look like, you just need to think of the advantages an limitations of each type, and integrate them into a working database. Lets take for an example a friends script. You’d want to have a list of your friends, and for each friend you’d want some other information that applies only to that friend. So, first of all you’d want to save the list of friends in a manageable list that you can save easily. We’ll use a custom @window for that: @Firends Nick1 Nick2 Nick3 Nick4 After we have the list of friends, we can loop through the window, search, sort, whatever, and get the nicknames we want. Now we’d want a categorized list of information to keep the data about each of the friends. So the best way would probably be hash tables that contain the friends’ nick so it can be accessed easily: Hash Friend-Nick1 channels networks notes You can access the hash easily by using $+(Friend-,nick) as the hash name. Now you can get the nicks’ information directly, by choosing an item name. Now inside the channels and network lists you can use a tokenized list, because the chances are you won’t have enough channels and networks to surpass 900 characters. If you use spaces ($chr(32)) as the C character, you can have an easy to read list, and you use the coma ($chr(44)) you’ll have a list of channels that can be used in mIRC’s commands (like /join #chan1,#chan2). channels = #chan1,#chan2,#chan3 networks = Network1 Network2 Network3 Now you have a nice hierarchy of databases that is easily accessed, and can be saved by simple inbuilt commands to files, for permanent storage. |